#include<stdio.h>
#include<stdbool.h>
#include<string.h>
#if 1
 int myStrlen(const char*str)
{
    int count = 0;
    while (true)
    {   
        if(*str!= '\0')
        {
            count++;
            str++;
        }
        else
        {
        break;
        }
    }
    
    
    return count;
}
#endif
#if 1
 int myStrcmp(const char *str1,const char * str2)
{
     while (*str1!= '\0'&&*str2!= '\0')
     {
        if(*str1 > *str2)
        {
            return 1;
        }
        else if(*str1 < *str2)
        {
            return -1;
        }
     else
     {
        str1++;
        str2++;
     }
        
     }
     int length1 = strlen(str1);
     int length2 = strlen(str2);
     if (length1 > length2)
     {
        return 1;
     }
     else if (length1 < length2)
     {
        return -1;
     }
     else
     {
        return 0;
     }
}
#endif
int main()
{
    char buffer[32] = "zhangsan and lisi";

    int length =  myStrlen(buffer);
    
    printf("length = %d\n",length);

    char buffer2[32] = "zhangsan and";
    int cmp = myStrcmp(buffer,buffer2);
    printf("cmp:%d\n",cmp);

    return 0;
}